<extend name="Public/base"/>

<block name="body">
    <div class="main-title">
        <h2>身份认证审批 </h2>
    </div>
<style type="text/css">
    .img-class-this{cursor:pointer;}	.layui-layer-content{		height:auto!important;	}
</style>
    <div class="cf">
        <a class="btn p0" href="__CONTROLLER__/index/passed/0">待审核</a>
        <a class="btn p1" href="__CONTROLLER__/index/passed/1">已通过</a>
        <a class="btn p2" href="__CONTROLLER__/index/passed/2">未通过</a>
		
		<?php if($_GET['passed'] == 0){?>
		<a class="btn p2" href="javascript:void(0);" onclick="batch_psd()">批量审核</a>
		<?php }?>
        <!-- 高级搜索 -->
        <!-- <div class="search-form fr cf">
            <div class="sleft">
                <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入菜单名称">
                <a class="sch-btn" href="javascript:;" id="search" url="__SELF__"><i class="btn-search"></i></a>
            </div>
        </div> -->
    </div>

    <div class="data-table table-striped">
        <form class="ids">
            <table>
                <thead>
                    <tr>
                        <th class="row-selected">
                            <input class="checkbox check-all" type="checkbox">
                        </th>
                        <th>昵称</th>
                        <th>姓名</th>
                        <th>身份证号码</th>
                        <th>身份证照片(正)</th>
                        <th>身份证照片(反)</th>
                        <th>提交时间</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
				<notempty name="lists">
                <volist name="lists.0" id="v">
                    <tr>
                        <td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$v.uid}"></td>
                        <td>
                            <a href="javascript:;">{$v.nickname}</a>
                        </td>
                        <td>{$v.truename}</td>
                        <td>{$v.authid}</td>
                        <td width="10%" ><img class="img-class-this" width="50px" height="50px" style="margin:10px auto;" src="__ROOT__{$v.imgfront|getimg=###}"></td>
                        <td width="10%" ><img class="img-class-this" width="50px" height="50px" style="margin:10px auto;" src="__ROOT__{$v.imgback|getimg=###}"></td>
                        <td>{$v.create_time|date='Y/m/d H:i:s',###}</td>
                        <td>
                            <a class="oper" href="javascript:;" data="{$v.uid}" val='1' flag="passed">
                                <neq name="Think.get.passed" value="1">通过</neq>
                            </a>
                            <a class="oper" href="javascript:;" data="{$v.uid}" val='2' flag="passed">
                                <neq name="Think.get.passed" value="2">不通过</neq>
                            </a>
                            <a class="oper" href="javascript:;" data="{$v.uid}" val='0' flag="status"><neq name="Think.get.passed" value="0">删除</neq></a>
                        </td>
                    </tr>
                </volist>
				<else/>
				<td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>
				</notempty>
                </tbody>
            </table>
        </form>
        <!-- 分页 -->
        <div class="page">
            {$lists.1}
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        $(function() {
            $('.oper').click(function(){
                var mes = $(this).html();
                if (confirm('确定要操作吗？')) {
                    var uid = $(this).attr('data');
                    var val = $(this).attr('val');
                    var flag = $(this).attr('flag');
                    $.post('__CONTROLLER__/edit', {'uid': uid,'val':val, 'flag':flag}, function(msg) {
                       alert(msg);
                       location.reload();
                    });
                }
            });

            //记录按钮默认颜色
            $('.p' + "{$Think.get.passed}").css('background','#0c7dac');

            //搜索功能
            // $("#search").click(function() {
            //     var url = $(this).attr('url');
            //     var query = $('.search-form').find('input').serialize();
            //     query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
            //     query = query.replace(/^&/g, '');
            //     if (url.indexOf('?') > 0) {
            //         url += '&' + query;
            //     } else {
            //         url += '?' + query;
            //     }
            //     window.location.href = url;
            // });

            //导航高亮
            highlight_subnav('{:U('index')}');

            //回车搜索
            $(".search-input").keyup(function(e) {
                if (e.keyCode === 13) {
                    $("#search").click();
                    return false;
                }
            });

        });

        $('.img-class-this').on('click',function(){
           var src = $(this).attr("src");
              layer.open({
                  type: 1,
                  area: ['500px', 'auto'],
                  shadeClose: true, //点击遮罩关闭
                  content: "<img class='class-img' src='"+src+"'>"
                  });
        });
		
		
		
		
			
		/*批量审核*/
		function batch_psd(){
	
			obj = document.getElementsByName("ids[]");
			check_val = [];
			for(k in obj){
				if(obj[k].checked)
					check_val.push(obj[k].value);
			}

			if(check_val == "" || check_val == null){
			
				alert("请选择要操作的数据！");
				return;
			
			}else{
			
		
				
			/*ajax*/
			$.post('__CONTROLLER__/ajaxedit', {'ids': check_val,'val':"1", 'flag':"passed"}, function(msg) {
                alert(msg);
                location.reload();
            });

			
			}

		}
		
		
		
    </script>
</block>